<!DOCTYPE html>
<!--<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 以下方式定时转到其他页面 -->
<!--    <meta http-equiv="refresh" content="5;url=add.html">-->
</head>

<!--  springboot-->
<script src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.easyui.min.js"></script>
<body>

<table border="1" style="border-collapse: collapse;">
    <caption>基本的联系</caption>
    <thead>
    <tr>
        <th>id</th>
        <th>名字</th>
        <th>登录账号</th>
        <th>密码</th>
    </tr>
    </thead>
   <tbody>
     <tr th:each="user:${entities}">
         <th th:text="${user.id}">id</th>
         <th th:text="${user.name}">name</th>
         <th th:text="${user.login}">login</th>
         <th th:text="${user.password}">password</th>

         <th>

             <a class="btn btn-sm btn-primary" th:href="@{/selectUp/}+${user.id}">编辑</a>

             <button th:attr="delete_uri=@{/delect/}+${user.id}" class="btn btn-sm btn-danger deleteBtn">删除</button>
         </th>
     </tr>




   </tbody>


</table>
<!--定义一个form表单，发送delete请求-->
<form id="deleteEmpForm" method="post">
    <input type="hidden" name="_method" value="DELETE">
</form>

<!--定义js方法，当点击删除按钮时，删除员工信息-->
<script>
    $(".deleteBtn").click(function(){
        //删除当前员工
        $("#deleteEmpForm").attr("action", $(this).attr("delete_uri")).submit();//action指定执行方法请求路径
        return false;
    })
</script>
<div>
  <div>================</div>
    <a  href = "/user/ahtml">
        <button>新增</button >
    </a>

</div>

</body>
</html>